package com.gulimall.cart.vo;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import java.math.BigDecimal;

/**
 * @author coder_ccy
 * @date 2022/4/2 16:55
 */
@Slf4j
public class CartItemVo {


    @Getter @Setter
    private Long skuId;

    /**
     * 是否选中
     */
    @Getter @Setter
    private Boolean check = true;
    @Getter @Setter
    private String title;
    @Getter @Setter
    private String image;

    @Getter @Setter
    private BigDecimal price;
    @Getter @Setter
    private Integer count;


    @Setter
    private BigDecimal totalPrice;    // fastjson  jackson  set方法  如果没有set方法复制的，转换不成功   gson 可以的  属性复制的

    public BigDecimal getTotalPrice() {

        log.info("=============="+price.multiply(new BigDecimal(count.toString())).toString());
        this.totalPrice = price.multiply(new BigDecimal(count.toString()));
        return this.totalPrice;
    }
}
